﻿using MesGLApp.DAL.RoleDTO;
using Smobiler.Core;
using Smobiler.Core.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MesGLApp.View
{
    partial class MeSettingFrm : Smobiler.Core.Controls.MobileUserControl
    {
        #region "内部变量"

        #endregion

        public MeSettingFrm() : base()
        {
            //This call is required by the SmobilerForm.
            InitializeComponent();
        }

        #region "控件事件"

        #endregion

        #region "内部方法"

        #endregion

        private void MeSettingFrm_Load(object sender, EventArgs e)
        {
            this.InitControlData(LoginFrm.LoginUser);
        }


        private void InitControlData(BaseUserDTO user)
        {
            if (user != null && user.id > 0)
            {
                this.lblUserName.Text = user.real_name;
                this.btnSex.Text = (user.sex ?? false) == true ? "男  >" : "女  >";
                this.lblPhone.Text = user.phone;
                this.lblEmail.Text = user.email;
            }
            else
            {
                this.lblUserName.Text = "";
                this.btnSex.Text = "男  >";
                this.lblPhone.Text = "";
                this.lblEmail.Text = "";
            }
        }

        private void btnExit_Press(object sender, EventArgs e)
        {
            MessageBox.Show("是否注销当前用户？", "系统提醒", MessageBoxButtons.OKCancel, (object sender1, MessageBoxHandlerArgs args) =>
            {
                if (args.Result == ShowResult.OK)
                    Client.ReStart();
            });
        }
    }
}